home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-23 | 2.6 KB | 109 lines | [TEXT/MMCC] |
- // If the interfaces aren't included yet, do the standard includes. Otherwise, precompiled headers
- // have been loaded already, thank you very much
- #ifndef __TYPES__
- #include <Types.h>
- #include <AppleEvents.h>
- #include <Desk.h>
- #include <Dialogs.h>
- #include <Editions.h>
- #include <Events.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <StandardFile.h>
- #include <TextUtils.h>
- #include <ToolUtils.h>
- #include <Windows.h>
- #endif
-
- #include "fileMenuRoutines.h"
- #include "WindowExtensions.h"
-
- /* Temporary defines */
-
- #define rAlertStringsID 129
- #define kOpenFileString 1
- #define kPrintFileString 2
- #define kNotificationString 3
-
- /* Private prototypes */
-
- void AlertUser(short alertStringID, Str255 fileName);
-
- // Globals
- extern Boolean gInBackground; /* Set to true if app is switched into background */
- extern Boolean gNotificationPosted; // True if a notification was posted
- extern NMRec gNotificationRec; // the notification record
- Str255 gErrString;
-
- void AlertUser(short alertStringID, Str255 fileName)
- {
- short alrtItem;
-
- // dkj 4/95 changed to use notification manager if not in front
- if(gInBackground)
- {
- if(gNotificationPosted == false)
- {
- // Get nifty notification string
- GetIndString(gErrString, rAlertStringsID, kNotificationString);
-
- // The WRONG way for an app to do it (just putting up an alert), but useful for testing
- gNotificationRec.qType = nmType; // Notification queue
- gNotificationRec.nmMark = 0; // no mark in app menu
- gNotificationRec.nmIcon = nil; // no Icon
- gNotificationRec.nmSound = (Handle)-1; // system alert sound
- gNotificationRec.nmStr = gErrString; // The meat of the matter
- gNotificationRec.nmResp = nil; // No response proc
- gNotificationRec.nmRefCon = nil; // No refcon
-
- NMInstall(&gNotificationRec);
- gNotificationPosted = true;
- }
- }
- else
- {
- DeactivateFloatersAndFirstDocumentWindow();
- GetIndString(gErrString, rAlertStringsID, alertStringID);
- ParamText(gErrString, fileName, nil, nil);
- alrtItem = Alert(129, nil);
- ActivateFloatersAndFirstDocumentWindow();
- }
- }
-
- void GetFileToOpen()
-
- /* Have user choose a file to open from StandardGetFile */
-
- {
- StandardFileReply fileInfo;
- SFTypeList typesToShow;
-
- typesToShow[0] = '****';
-
- DeactivateFloatersAndFirstDocumentWindow();
- StandardGetFile(nil, -1, typesToShow, &fileInfo);
-
- if (fileInfo.sfGood)
- DoOpenFile(&(fileInfo.sfFile));
-
- ActivateFloatersAndFirstDocumentWindow();
- }
-
- void DoOpenFile(FSSpec *fileToOpen)
-
- {
- AlertUser(kOpenFileString, fileToOpen->name);
- }
-
- void DoPrint()
-
- {
- }
-
- void DoPrintFile(FSSpec *fileToPrint)
-
- {
- AlertUser(kPrintFileString, fileToPrint->name);
- }
-
-